package com.design01_builder.pattern02_factory.simple_factory.factory;

import com.design01_builder.pattern02_factory.simple_factory.service.DiscountFreeGoods;
import com.design01_builder.pattern02_factory.simple_factory.service.IFreeGoods;
import com.design01_builder.pattern02_factory.simple_factory.service.SmallGiftFreeGoods;
import com.design01_builder.pattern02_factory.simple_factory.service.YouKuMemberFreeGoods;

/**
 * @ClassName FreeGoodsFactory
 * @Description 具体工厂: 生成免费商品
 * @Author zhangjunhao
 * @DATE 2023/9/2 1:16
 */
public class FreeGoodsFactory {

    public static IFreeGoods getInstance(Integer awardType){
        IFreeGoods iFreeGoods = null;
        if(awardType == 1){ //打折券
            iFreeGoods = new DiscountFreeGoods();
        }else if(awardType == 2){ //优酷会员
            iFreeGoods = new YouKuMemberFreeGoods();
        }else if(awardType == 3){ //小礼品
            iFreeGoods = new SmallGiftFreeGoods();
        }
        return iFreeGoods;
    }
}

